﻿@{
    ViewData["Title"] = "Index";
}
@model List<List<string>>
<h1>这里SSO,恭喜您登录成功！</h1>
<a href="http://www.web1.com/">Web1</a>
<a href="http://www.web2.com/">Web2</a>
<form id="postForm" action="/Account/Logout" method="POST">
    <input id="logout" type="button" value="注销" />
</form>
<table>
    @foreach (var itemList in Model)
    {
        <tr>
            @foreach (var item in itemList)
            {
                <td>@item</td>
            }
        </tr>
    }
</table>
<script src="~/jquery-1.10.2.js"></script>
<script src="~/jquery.form.js"></script>
<script>
    $(function () {
        $("#logout").click(function () {
            $("#postForm").ajaxSubmit(function () {
                var authorizeHostArray = new Array(
                    "http://www.web1.com/Token/Logout",
                    "http://www.web2.com/Token/Logout"
                );
                var authorizeHostParams = "";
                authorizeHostArray.forEach(function (item) {
                    authorizeHostParams += "hostAuthorization=" + item + "&";
                });
                window.location.href = authorizeHostArray[0] + "?" + authorizeHostParams;
            });
        });
    })
</script>